package com.skillworld.webapp.model.tutorialservice;

import java.util.List;
import java.util.Locale;

import com.skillworld.webapp.model.complaint.Complaint;
import com.skillworld.webapp.model.complaint.Complaint.Type;
import com.skillworld.webapp.model.tutorial.MarkFilter;
import com.skillworld.webapp.model.tutorial.MarkedTutorial;
import com.skillworld.webapp.model.tutorial.Tutorial;
import com.skillworld.webapp.model.tutorial.MarkedTutorial.Mark;
import com.skillworld.webapp.model.tutorial.Tutorial.Status;
import com.skillworld.webapp.model.tutorial.TutorialOrder;
import com.skillworld.webapp.model.util.InvalidArgumentException;
import com.skillworld.webapp.model.util.PermissionDeniedException;

import es.udc.pojo.modelutil.exceptions.InstanceNotFoundException;


public interface TutorialService
{
	public List<Tutorial> searchTutorials(String query, Long dept, 
	        Integer duration, Locale locale, List<Status> status,
	        Long author, List<Long> nonAuthors,
	        MarkFilter marked, 
	        Long notInCourse, 
	        TutorialOrder orderBy, 
	        int startIndex, int count);
	public int numberOfTutorials(String query,Long dept, 
	        Integer duration, Locale locale, List<Status> status, 
	        Long author, List<Long> nonAuthors, 
	        MarkFilter marked, Long notInCourse);
	public Tutorial findTutorial(Long tutorialId)
	        throws InstanceNotFoundException;
	public List<Mark> findTutorialMarks(long userId, long tutorialId);
    public List<Tutorial> findTutorialVersions(long tutorialId)
            throws InstanceNotFoundException;
    public TutorialInfo viewTutorial(long userId, long tutorialId)
            throws InstanceNotFoundException;
	public Tutorial createTutorial(long userId, long departmentId, 
	                                Long originalId, String xml)
	        throws InstanceNotFoundException, InvalidTutorialFormat;
	public Tutorial translateTutorial(long userId, long tutorialId, 
	                                    String xml)
	        throws InstanceNotFoundException, PermissionDeniedException,
	                TranslationAlreadyExistsException, InvalidTutorialFormat;
    public void rateTutorial(Long userId, Long tutorialId, int rating)
            throws InstanceNotFoundException, PermissionDeniedException;
    /**
     * For now, this use case is rather useless, but in the 
     * future this use case will request the user to do a test 
     * in order to give s/he a mark.
     */
    public void doTutorial(long userId, long tutorialId) 
	        throws InstanceNotFoundException,
	                PermissionDeniedException, TutorialAlreadyDoneException;
	public void markTutorial(long userId, long tutorialId, Mark mark) 
	        throws InstanceNotFoundException, MarkAlreadyExistsException,
	                PermissionDeniedException, TutorialAlreadyDoneException;
    public void unmarkTutorial(long userId, long tutorialId, Mark mark) 
            throws InstanceNotFoundException, MarkDoesNotExistException, 
                    PermissionDeniedException;
	/* public List<Tutorial> viewPendingTutorials(...) throws ... */
	public void evaluateTutorial(long validatorId, long tutorialId, 
	                                Status decision, String comment)
	        throws InstanceNotFoundException, PermissionDeniedException, 
	                AlreadyEvaluatedException;
	/* public List<Tutorial> viewAlreadyDone(...) throws ... */
	
	public List<Tutorial> topTutorials(int count) throws InvalidArgumentException;
	public Complaint complain(long userId, long tutorialId, Type type, String text)
	        throws InstanceNotFoundException, PermissionDeniedException;
	
	//Deprecated ?
	public double getRatedByUser(Long userId, Long tutId);
}
